package com.ruoyi.project.dict.shuowenmapper.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.dict.shuowenmapper.domain.ShuowenMapper;
import com.ruoyi.project.dict.shuowenmapper.mapper.ShuowenMapperMapper;
import com.ruoyi.project.dict.shuowenmapper.service.IShuowenMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 难检匹配Service业务层处理
 *
 * @author shixiangwen
 * @date 2022-06-02˜˜
 */
@Service
@DataSource(DataSourceType.DICT)
public class ShuowenMapperServiceImpl implements IShuowenMapperService {
    @Autowired
    private ShuowenMapperMapper shuowenMapperMapper;

    /**
     * 查询难检匹配
     *
     * @param id 难检匹配ID
     * @return 难检匹配
     */
    @Override
    public ShuowenMapper selectShuowenMapperById(Long id) {
        return shuowenMapperMapper.selectShuowenMapperById(id);
    }

    /**
     * 查询难检匹配列表
     *
     * @param shuowenMapper 难检匹配
     * @return 难检匹配
     */
    @Override
    public List<ShuowenMapper> selectShuowenMapperList(ShuowenMapper shuowenMapper) {
        return shuowenMapperMapper.selectShuowenMapperList(shuowenMapper);
    }

    /**
     * 新增难检匹配
     *
     * @param shuowenMapper 难检匹配
     * @return 结果
     */
    @Override
    public int insertShuowenMapper(ShuowenMapper shuowenMapper) {
        return shuowenMapperMapper.insertShuowenMapper(shuowenMapper);
    }

    /**
     * 修改难检匹配
     *
     * @param shuowenMapper 难检匹配
     * @return 结果
     */
    @Override
    public int updateShuowenMapper(ShuowenMapper shuowenMapper) {
        return shuowenMapperMapper.updateShuowenMapper(shuowenMapper);
    }

    /**
     * 删除难检匹配对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteShuowenMapperByIds(String ids) {
        return shuowenMapperMapper.deleteShuowenMapperByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除难检匹配信息
     *
     * @param id 难检匹配ID
     * @return 结果
     */
    @Override
    public int deleteShuowenMapperById(Long id) {
        return shuowenMapperMapper.deleteShuowenMapperById(id);
    }

    @Override
    public boolean updateStatus(Long id, Integer status) {
        ShuowenMapper shuowenMapper = shuowenMapperMapper.selectShuowenMapperById(id);
        shuowenMapper.setStatus(status);
        shuowenMapperMapper.updateShuowenMapper(shuowenMapper);
        return true;
    }
}
